package com.macoli.method_trace_log_helper;

import android.util.Log;

import java.util.concurrent.ConcurrentHashMap;

public class MethodTraceHelper {
    private static ConcurrentHashMap<String , Long> methodMap = new ConcurrentHashMap<>() ;
    public static void methodEnter(String name) {
//        Log.d("gggl" , "enter : " + name) ;
        methodMap.put(name , System.nanoTime()) ;
    }

    public static void methodExit(String name) {
        long startTime = methodMap.get(name) ;
        if (startTime != 0) {
            Log.d("gggl" , name + " cost : " + (System.nanoTime() - startTime)) ;
        }
    }
}
